package com.lyc.demo.msg;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PaymentNotifySender {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void sender(String msg) {
        logger.info("notify.payment send message: " + msg);
        rabbitTemplate.convertAndSend("fanout", "", msg);
    }
    public void sender2(String msg) {
        logger.info("topic.message send message: " + msg);
        rabbitTemplate.convertAndSend("mybootexchange", "topic.message", msg);
    }
    public void sender3(String msg) {
        logger.info("topic.messages send message: " + msg);
        rabbitTemplate.convertAndSend("mybootexchange", "topic.message.a.b", msg);
    }
}
